package com.onlyphoto.onlymall.mvp.presenter

import android.content.Context
import com.onlyphoto.onlymall.base.BaseNetworkResponse
import com.onlyphoto.onlymall.base.BaseObserver

import com.onlyphoto.onlymall.mvp.contract.CPayMethod
import com.onlyphoto.onlymall.mvp.model.MPayMethodImpl
import com.onlyphoto.onlymall.base.BasePresenter
import com.onlyphoto.onlymall.bean.response.WxPayParamsBean


class PPayMethodImpl(mContext: Context, mView: CPayMethod.IVPayMethod) : BasePresenter<CPayMethod.IVPayMethod, MPayMethodImpl>(mContext, mView, MPayMethodImpl()), CPayMethod.IPPayMethod {
    override fun getWxPayParams(orderId: String) {
        mModel.getWxPayParams(orderId, object :BaseObserver<WxPayParamsBean>(mContext.get()){
            override fun onSuccess(data: WxPayParamsBean?, msg: String?) {
                mView.getWxPayParamsSuccess(data!!)
            }

            override fun onCodeError(t: BaseNetworkResponse<WxPayParamsBean>?) {
            }

            override fun onFailure(e: Throwable?) {
            }

            override fun onRequestStart() {
            }

            override fun onFinally() {
            }

        })
    }

    override fun getAliPayParams(orderId: String) {
        mModel.getAliPayParams(orderId, object :BaseObserver<String>(mContext.get()){
            override fun onSuccess(data: String?, msg: String?) {
                mView.getAliPayParamsSuccess(data!!)
            }

            override fun onCodeError(t: BaseNetworkResponse<String>?) {
            }

            override fun onFailure(e: Throwable?) {
            }

            override fun onRequestStart() {
            }

            override fun onFinally() {
            }

        })
    }
}
